package com.zsrt.java.day20161223.wrl.t03;

import java.util.Scanner;

public class LookProduct {
	public static void main(String[] args) {
		String name = "";	//商品名称
		float price = 0.0f;	//商品价格
		int proNo;			//商品编号
		
		/*打印产品清单*/
		System.out.println("**************************");
		System.out.println("请选择商品编号：\n");
		System.out.println("1.巧克力    2.红牛    3.娃哈哈");
		System.out.println("***************************");
		
		Scanner input = new Scanner(System.in);
		String answer = "y";		//标识是否继续
		while(answer.equals("y")){	//con的值为“y”，是执行循环体
			System.out.println("请输入资产编号：");
			proNo = input.nextInt();	//从键盘上获取资产编号
			switch (proNo) {
			case 1: 	
				name  ="巧克力";
				price = 10.8f;
				break;
			case 2: 	
				name  ="红牛";
				price = 5.5f;
				break;
			case 3: 	
				name  ="5娃哈哈";
				price = 3.5f;
				break;
			}
			System.out.println(name + "\t"+"$"+price);//输出资产名称和价格
			System.out.println("\n是否继续（y/n）");
			answer = input.next();		//用户再次输入是否继续的信息
		}
		System.out.println("\n程序结束");
		input.close();
	}

}
